﻿@{
    ViewBag.Title = "MemberTagInfo";
}
@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script>
    <link href="~/Scripts/miniui/themes/default/medium-mode.css" rel="stylesheet" type="text/css" />
}

<form id="form1" method="post">
    @Html.Partial("~/Views/Modular/Toolbars.cshtml")
    <div name="Base" title="标签资料" style="overflow:hidden;margin-top:15px;margin-left:20px">
        <table>
            <tr>
                <td width="80px" height="50px" align="right">
                    标签名称：
                </td>
                <td width="250px" height="50px">
                    <input id="FName" name="FName" class="mini-textbox " style="width:250px;"  TabIndex="1" />
                </td>
            </tr>
            <tr>
                <td width="80px" height="50px" align="right">
                    &nbsp;&nbsp;备&nbsp;&nbsp;注：
                </td>
                <td width="250px" height="50px">
                    <input id="FRemark" name="FRemark" class="mini-textbox " style="width:250px;" TabIndex="2" />
                </td>
            </tr>
        </table>
        <br />
    </div>
    <input name="FItemID" class="mini-hidden" />
</form>

<script>
    mini.parse();
    function FormShown() {
    }

    //加载资料
    function SetInfoData(data) {
        if (data.action == "new") {
            NewInfo();
        }
        else {
            $.post("GetMemberTag", { json: "[{'FItemID':'" + data.FItemID + "','mSystemAppID':'" + parent.window.getSystemAppID() + "'}]" }, function (data) {
                var form = new mini.Form("form1");
                var mdata = mini.decode(data);
                mini.getbyName("FItemID").setValue(mdata.data[0].FItemID);
                form.setData(mdata.data[0]);                
            });
        }
    }

    //新增资料
    function NewInfo() {
        mini.getbyName("FItemID").setValue("0");
        mini.getbyName("FName").setValue("");
        mini.getbyName("FRemark").setValue("");
    }

    //保存资料
    function SaveInfo() {
        if (mini.getbyName("FName").getValue() == '') {
            mini.alert("标签名不能为空");
            return;
        }
        if (mini.getbyName("FName").getValue().Length>50) {
            mini.alert("标签名不能大于50个字");
            return;
        }
        if (mini.getbyName("FRemark").getValue().Length > 200) {
            mini.alert("备注不能大于200个字");
            return;
        }
        mini.getbyName("SaveInfo").setEnabled(false);
        var form = new mini.Form("#form1");
        var data = form.getData(true, false);

        var json = mini.encode(data);
        $.post("SaveMemberTagInfo", { json: json, mSystemAppID: parent.window.getSystemAppID() }, function (data) {
            var ret = mini.decode(data);
            if (ret.status == 1) {
                mini.showTips({ content: ret.msg, state: "success", x: "center", y: "top", timeout: 3000 });
                NewInfo();
            }
            else {
                mini.alert("异常:" + ret.error);
            }
            mini.getbyName("SaveInfo").setEnabled(true);
        });
    }

</script>